home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 10 / The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso / PC_SIGCD / 22 / 4 / DISK2247.ZIP / CBDDL102.ZIP / CBDDLP.RME < prev    next >
Text File  |  1990-07-03  |  8KB  |  261 lines

  1. ----------------------------------------------------------------------
  2. | Citadel                                                            |
  3. | 241 East Eleventh Street * Brookville, IN 47012 * 317-647-4720     |
  4. |                                               BBS 317-647-2403     |
  5. ----------------------------------------------------------------------
  6.  
  7. cbddlp is distributed in a single compressed file cbddlRL.zip; R and L
  8. would be the release and level numbers, respectively.  The ZIP data
  9. compression utilities are needed to extract the individual files.
  10.  
  11. The following files are obtained by decompressing cbddlRL.zip:
  12.  
  13.   cbddlp.rme  preliminary information
  14. rlsnotes.txt  release notes
  15.   cbddlp      cbddlp program (UNIX System V/386)
  16.   cbddlp.exe  cbddlp program (MS-DOS)
  17. rolodeck.ddl  example ddl file
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.                                                      Citadel  90/07/03
  53. ----------------------------------------------------------------------
  54. | cbddlp - cbase data definition language processor                  |
  55. | Version 1.0.2                                                      |
  56. ----------------------------------------------------------------------
  57.  
  58. ======================================================================
  59. COPYRIGHT
  60.  
  61. Copyright (c) 1989 Citadel.
  62.  
  63. Citadel
  64. 241 East Eleventh Street
  65. Brookville, IN 47012
  66. 317-647-4720
  67. BBS 317-647-2403
  68.  
  69. cbddlp is a support program for the cbase library.  cbddlp itself as
  70. well as the accompanying files are part of cbase, and are therefore
  71. subject to the copyright restrictions of cbase; see the appropriate
  72. file in the cbase distribution for this copyright information.  The
  73. latest version of cbase is available on the Citadel BBS.
  74.  
  75. ======================================================================
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.                                                      Citadel  90/07/03
  105. NAME
  106.      cbddlp - cbase data definition language processor
  107.  
  108. SYNOPSIS
  109.      cbddlp ddlfile
  110.  
  111. DESCRIPTION
  112.      The cbddlp command processes cbase data definition language (ddl)
  113.      files.  A cbase database can be specified in a ddl file, which is
  114.      then processed using cbddlp to generate the C files required by
  115.      cbase to access that database.  ddl files are conventionally
  116.      given a .ddl suffix, but this is not required by cbddlp.  The C
  117.      files generated are given the same name as the ddl file except
  118.      for the suffix; a .h and a .i file are generated.  The .h file is
  119.      to be included in every module accessing the database.  The .i
  120.      file is to included in exactly one module of every program
  121.      that accesses the database.
  122.  
  123.      There are three types of ddl statements:  data file, index file,
  124.      and record.  The syntax for the record statement is
  125.  
  126.           record recname {
  127.                [[unique ]key] cbtype fldname[[size]];
  128.                ...
  129.           };
  130.  
  131.      recname is the name of the record.  cbtype is the cbase data type
  132.      of the field.  fldname is the name of the field, and must be
  133.      unique for a given database.  size specifies the number of
  134.      elements for array data types; this may be either an integral
  135.      numeric literal (e.g., 24), or a macro which evaluates to an
  136.      integer (e.g., NAME_MAX).  If a macro is used, its definition
  137.      must always precede the inclusion of the data definition .h file.
  138.      The key keyword specifies that an index is to be maintained on
  139.      this field.  The unique keyword specifies that the keys in this
  140.      index must be unique.  Multiple records can be defined in the
  141.      same ddl file.
  142.  
  143.      User-defined data types may also be specified in a ddl file, but
  144.      require an additional piece of information.  For the predefined
  145.      data types, cbddlp knows what the corresponding C data type is
  146.      (t_string : char, t_int : int, etc.).  But for user-defined data
  147.      types, this must be explicitly specified.  The syntax for this is
  148.      as follows.
  149.  
  150.           [[unique ]key] usrtype:ctype fldname[[size]];
  151.  
  152.      usrtype is the name of the user defined data type.   ctype is the
  153.      corresponding C data type (char, int, long, etc.).  ctype must
  154.      consist of only one identifier;  If the C data type consists of
  155.  
  156.                                                      Citadel  90/07/03
  157.  
  158.      multiple identifiers (e.g., long double), either #define or
  159.      typedef must be used to reduce it to one identifier (e.g.,
  160.      typedef long double ldouble).
  161.  
  162.      The syntax for the data file statement is
  163.  
  164.           data file "filename" contains recname;
  165.  
  166.      filename is the name of the file in which recname records are to
  167.      be stored.  The data file statement must precede its associated
  168.      record statement.
  169.  
  170.      The syntax for the index file statement is
  171.  
  172.           index file "filename" contains keyname;
  173.  
  174.      filename is the name of the file in which keyname keys are to be
  175.      indexed.  The index file statement must precede the record
  176.      statement containing the associated key.
  177.  
  178.      In the headers generated by cbddlp, a macro for the cbase name
  179.      for a record is constructed by converting all lower case letters
  180.      in the record name to capitals.  A macro is defined for each
  181.      field.  The macro identifier is constructing by converting all
  182.      lower case letters in the field name to upper case.  The initial
  183.      characters (up to four) of the first field name of a record
  184.      preceding the first underscore are used as the prefix for the
  185.      field count macro and field definition list.  The field count
  186.      macro identifier is constructed by converting this prefix to
  187.      capitals and appending FLDC.  The field definition list
  188.      identifier is constructed by appending fldv to the prefix.
  189.  
  190.      ddl files can also contain C style comments.
  191.  
  192. EXAMPLE
  193.      Below is given an example ddl file for a rolodeck database
  194.      consisting of a single record.
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.                                                      Citadel  90/07/03
  209.      data file  "rolodeck.dat" contains rolodeck;
  210.      index file "rdcont.ndx"   contains rd_contact;
  211.      index file "rdcomp.ndx"   contains rd_company;
  212.  
  213.      record rolodeck {                       /* rolodeck record */
  214.          unique key t_string rd_contact[41]; /* contact name */
  215.          t_string            rd_title[41];   /* contact title */
  216.          key t_string        rd_company[41]; /* company name */
  217.          t_string            rd_addr[81];    /* address */
  218.          t_string            rd_city[26];    /* city */
  219.          t_string            rd_state[3];    /* state */
  220.          t_string            rd_zip[11];     /* zip code */
  221.          t_string            rd_phone[13];   /* phone number */
  222.          t_string            rd_ext[5];      /* phone extension */
  223.          t_string            rd_fax[13];     /* fax number */
  224.          t_string            rd_notes[161];  /* notes */
  225.      };
  226.  
  227.      If the name of this ddl file was rolodeck.ddl, the generated C
  228.      files would be rolodeck.h and rolodeck.i.  The cbase name macro
  229.      would be ROLODECK (the record identifier capitalized).  The field
  230.      count macro would be RDFLDC.  The field definition list would be
  231.      rdfldv.  The rolodeck would be therefore be opened (for writing)
  232.      as follows.
  233.  
  234.           cbopen(ROLODECK, "r+", RDFLDC, rdfldv);
  235.  
  236. DIAGNOSTICS
  237.      Exit status is 0 if the ddl file is processed with no errors,
  238.      otherwise 1.
  239.  
  240. NOTES
  241.      For a make utility to automatically process ddl files without an
  242.      explicit rule for each one, suffix rules defining the creation of
  243.      the data definition header files from a ddl file must be added to
  244.      the makefile.  For the standard UNIX make, the following
  245.      instructions would be inserted near the beginning of the
  246.      makefile.
  247.  
  248.      # suffix rules
  249.      .SUFFIXES:      .ddl .h .i
  250.  
  251.      .ddl.h:
  252.           cbddlp $<
  253.  
  254.      .ddl.i:
  255.           cbddlp $<
  256.  
  257.      The exact procedure for other make utilities vary.  Also, the
  258.      documention may refer to suffix rules as implicit rules.
  259.  
  260.                                                      Citadel  90/07/03
  261.